/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Login;

import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.Panel;
import java.awt.TextField;
import javax.swing.*;

/**
 *
 * @author Administrator
 */
public class LoginDemo extends JFrame {

    public LoginDemo(String s) {
        super(s);
        BorderLayout b = new BorderLayout();
        this.getContentPane().setLayout(b);
        JLabel title = new JLabel("登录窗口", JLabel.CENTER);
        Panel middle = new Panel();
        middle.setLayout(new GridLayout(2, 2));
        JLabel l1 = new JLabel("请输入用户名", JLabel.RIGHT);
        TextField t1 = new TextField();
        JLabel l2 = new JLabel("请输入密码", JLabel.RIGHT);
        TextField t2 = new TextField();
        middle.add(l1);
        middle.add(t1);
        middle.add(l2);
        middle.add(t2);
        JPanel bottom = new JPanel();
        bottom.setLayout(new FlowLayout(FlowLayout.CENTER));
        JButton b1 = new JButton("提交");
        JButton b2 = new JButton("清除");
        bottom.add(b1);
        bottom.add(b2);
        this.getContentPane().add("North", title);
        this.getContentPane().add("South", bottom);
        this.getContentPane().add("Center", middle);
        this.pack();
    }
    public static void main(String[] args) {
        LoginDemo test = new LoginDemo("登入");
        test.show();
    }
}
